import sys

def swap(array, a, b):
	tmp = array[a]
	array[a] = array[b]
	array[b] = tmp
	
#partition array according to array[i]
def partition(array, range, pivotIndex):
	left, right = range				
	#var left=range[0];
	#var right=range[1];
	pivotValue = array[pivotIndex]
	swap(array, pivotIndex, right)
	storeIndex = left
	i = left
	while i < right:
		if array[i] < pivotValue:
			swap(array, storeIndex, i)
			storeIndex += 1
		i += 1
	swap(array, right, storeIndex)
	return storeIndex

	
def qsort(array, left, right):
	if right > left:
		pivotNewIndex = partition(array, (left, right), left)
		qsort(array, left, pivotNewIndex-1)
		qsort(array, pivotNewIndex+1, right)

def sort(array, len):
	qsort(array, 0, len-1)

	
def ordered(array, len):
	i = 1
	while i < len:
		if array[i-1]>array[i]:
			return False
		i += 1
	return True


arr = [5, 4, 2, 7, 0, 6, 1, 3, 8, 9]
retcode = {True:0, False:1}
succ = True
succ = succ and not ordered(arr,10)
sort(arr,10)
succ = succ and ordered(arr,10)

sys.exit(retcode[succ])
